package com.hyacinth.common.jpql;

public class Field {
	
	private String alias;
	private StringBuilder fields;
	
	Field(String alias) {
		this.alias = alias;
		fields = new StringBuilder();
	}
	
	public Field add(String ...propertys) {
		for(String p : propertys) {
			if(!this.fields.toString().equals(""))
				fields.append(", ");
			fields.append(alias).append(".").append(p);
		}
		return this;
	}
	
	@Override
	public String toString() {
		if(this.fields.toString().equals(""))
			return this.alias;
		else return this.fields.toString();
	}

}
